@echo off
set errors=0

cd SpyHud

for /D %%i in (*) do (
   for %%j in (%%i\*.lua) do (
      echo Parsing %%j
      luac -p %%j
      if ERRORLEVEL 1 set errors=1
   )
)

if %errors% NEQ 0 (
   echo Errors found while parsing scripts.
)else (
   echo -------------- No Parsing Errors --------------
   for /D %%i in ("*") do (
      echo Deploying %%i...
      rmdir "%WoW%\Interface\Addons\%%i" /Q /S
      xcopy "%%i" "%WoW%\Interface\Addons\%%i" /S /I /Q
      xcopy "..\libs" "%WoW%\Interface\Addons\%%i\Libs" /S /I /Q
   )
   echo -------------- SUCCESS! --------------
)
